package org.example.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.entiey.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;


@RestController
@Slf4j
public class HelloController {
    @Value("${server.port}")
    private String serverPort;

    @GetMapping(value = "/hello/nacos/{id}")
    public String getPayment(@PathVariable("id") Integer id) {
        return "服务名：spring-cloud-alibaba-provider<br /> 端口号： " + serverPort + "<br /> 传入的参数：" + id;
    }

    //feign的参数绑定
    @GetMapping(value = "/hello1")
    public String hello(@RequestParam String name){
        return "hello,"+name;
    }
    @PostMapping(value = "/hello2")
    public String hello(@RequestBody User user){
        return "hello,"+user.getName()+","+user.getAge();
    }

}

